package com.woniuxy.mesboot.service.impl;

import com.woniuxy.mesboot.dto.PPDTO;
import com.woniuxy.mesboot.entity.MesProcess;
import com.woniuxy.mesboot.entity.MesProcessDetails;
import com.woniuxy.mesboot.mapper.MesProcessDetailsMapper;
import com.woniuxy.mesboot.service.ProcessDetailsService;
import com.woniuxy.mesboot.vo.MesProcessDetailVO;
import com.woniuxy.mesboot.vo.ProcessVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProcessDetailsServiceImpl implements ProcessDetailsService {
    @Resource
    private MesProcessDetailsMapper processDetailsMapper;

    @Override
    public List<ProcessVO> selectlist() {
        List<ProcessVO> selectlist = processDetailsMapper.selectlist();
        for (int i = 0; i < selectlist.size(); i++) {
            Integer id = selectlist.get(i).getOperationProcedureId();
            selectlist.get(i).setMesProcessDetailVOList(processDetailsMapper.selectByOperationProcedureId(id));
        }
        return selectlist;
    }

    @Override
    public MesProcessDetails selectMatNumByOperationProcedureId(Integer id) {
        return processDetailsMapper.selectMatNumByOperationProcedureId(id);
    }

    @Override
    public List<MesProcessDetailVO> selectByOperationProcedureId(Integer id) {
        return processDetailsMapper.selectByOperationProcedureId(id);
    }

    @Override
    public List<MesProcessDetails> selectAll() {
        return processDetailsMapper.selectAll();
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return processDetailsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(MesProcessDetails record) {
        return processDetailsMapper.insert(record);
    }

//    @Override
//    public int insertSelective(MesProcess record) {
//        return processDetailsMapper.insertSelective(record);
//    }

    @Override
    public MesProcessDetails selectByPrimaryKey(Long id) {
        return processDetailsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(MesProcessDetails record) {
        return processDetailsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(MesProcessDetails record) {
        return processDetailsMapper.updateByPrimaryKey(record);
    }
}
